package react.api;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import react.model.Employee;
import react.repository.EmployeeRepository;
import react.repository.UserRepository;

/**
 * Created by tiansha on 2016/3/19.
 */
@Component
public class DatabaseLoader implements CommandLineRunner {

    @Autowired
    private EmployeeRepository employeeRepository;

    @Autowired UserRepository userRepository;

    @Override
    public void run(String... strings) throws Exception {

        this.employeeRepository.save(new Employee("Frodo", "Baggins", "ring bearer"));
        this.employeeRepository.save(new Employee("Bilbo", "Baggins", "burglar"));
        this.employeeRepository.save(new Employee("Gandalf", "the Grey", "wizard"));

        this.employeeRepository.save(new Employee("Samwise", "Gamgee", "gardener"));
        this.employeeRepository.save(new Employee("Merry", "Brandybuck", "pony rider"));
        this.employeeRepository.save(new Employee("Peregrin", "Took", "pipe smoker"));



    }
}
